import React, {Component} from 'react';
import './App.css';
import AreaManage from './area';
import FixedTableDemo from './area/fixed-table-demo';
import {Spin, Tabs, Row, Col, Button, Select} from 'antd';
import {AreaService} from './services';

class App extends Component {

    state = {
        dataKey: "0fd99cd7-8a12-8c7f-d893-8520db3a298e",//分期
        isProOrStage: "Stage",//分期
    };

    componentDidMount() {
        this.testCors();
    };

    testCors = () => {
        AreaService.testLogin().then(loginRes=>{
            console.log("loginRes", loginRes);
            return AreaService.testCors();
        })
        .then(res => {
            console.log("res", res);
        }).catch(error => {
            console.error("error", error);
        })
    };

    handleClick = () => {
        this.setState({
            dataKey: new Date().getTime().toString(),
        });
    };

    render() {
        const {dataKey, isProOrStage} = this.state;
        //http://localhost:65162/AreaInfo/Index/#/manage?isProOrStage=2&dataKey=e2f23b9a-31e4-821d-25cf-22c46927e1b8&_k=9gjhxh
        //dataKey 项目id / 分期版本id
        //isProOrStage 1项目，2分期
        const location = {
            query: {
                dataKey,
                isProOrStage
                // dataKey: "FF55B246EA0B4A81995C53F49B052A68",//项目
                // isProOrStage: "Project",//项目

                // dataKey: "0fd99cd7-8a12-8c7f-d893-8520db3a298e",//分期
                // isProOrStage: "Stage",//分期
            }
        };

        return (
            <div className="App">
                测试cors跨域
                {/*<Button onClick={this.handleClick}>修改</Button>*/}
                {/*<AreaManage location={location}/>*/}
                {/*<FixedTableDemo></FixedTableDemo>*/}
            </div>
        );
    }
}

export default App;
